In conventional graphics processing systems, an object to be displayed is typically represented as a set of one or more graphics primitives. Examples of graphics primitives include one-dimensional graphics primitives, such as lines, and two-dimensional graphics primitives, such as polygons. Typically, a graphics primitive is defined by a set of vertices having a particular order that is specified by a graphics program. For example, one graphics primitive can be defined by three vertices that are ordered as (V0, V1, V2), while another graphics primitive can be defined by the same three vertices that are ordered differently as (V2, V0, V1). In this example, the two graphics primitives are, in fact, visually identical, even though they differ in their vertex ordering.
Conventional graphics processing systems sometimes implement techniques for clipping graphics primitives. Clipping typically refers to a set of operations that determine which portions of an object are to be displayed with respect to a set of clipping planes. Various techniques have been developed for clipping graphics primitives. Examples of these techniques include the Cohen-Sutherland technique, the Liang-Barsky technique, the Sutherland-Hodgeman technique, and the Weiler technique. Of these techniques, the Sutherland-Hodgeman technique is perhaps the most commonly used. For example, to clip a polygon with respect to six clipping planes, the Sutherland-Hodgeman technique typically clips each edge of the polygon with respect to a first clipping plane to produce a first clipped polygon. Each edge of the first clipped polygon is then typically clipped with respect to a second clipping plane to produce a second clipped polygon. The second clipped polygon is then typically clipped with respect to a third clipping plane, and so on until all six clipping planes have been processed.
When clipping a graphics primitive with respect to a set of clipping planes, it is desirable to produce a consistent result, irrespective of a particular vertex ordering of the graphics primitive. However, a conventional clipping technique typically involves a number of operations, such as additions, compares, multiplications, reciprocals, and subtractions, and implementing these operations in realizable hardware often produces a result that is relatively sensitive to the vertex ordering. In particular, a graphics primitive is sometimes clipped by performing a set of floating point calculations, which often involve some approximation or rounding because of a limited precision range associated with floating point numbers. As can be appreciated, floating point calculations are typically not associative, such that (x+y)+z≠x+(y+z) and (x×y)×z≠x×(y×z) for floating point numbers x, y, and z. For example, a floating calculation of (1e100−1e100)+1 can give a result that is 1, whereas a floating calculation of (1e100+1)−1e100 can give a result that is 0. As a result, an output of floating point calculations for clipping a graphics primitive can be dependent upon an order in which these floating point calculations are performed, which, in turn, can be dependent upon a vertex ordering of the graphics primitive. Such dependency on vertex ordering can lead to inconsistencies when clipping graphics primitives that simply differ in their vertex ordering and can produce artifacts, such as when rendering the graphics primitives sequentially or at the same time. For example, differences in resulting coordinate data can lead to one of the graphics primitives being subsequently culled, while another one of the graphics primitives is not subsequently culled.
It is against this background that a need arose to develop the apparatus, system, and method described herein.